<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>WISSC轮滑教培服务网-查询系统</title>
<#assign base=request.contextPath  />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="icon" href="${base}/favicon.ico">
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css" media="all">
    <script type="text/javascript" src="${base}/js/feng.js"></script>
    <script src="${base}/js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/css/hzw-city-picker.css">
    <script type="text/javascript" src="${base}/js/city-data.js"></script>
    <script type="text/javascript" src="${base}/js/hzw-city-picker.min.js"></script>
    <script src="${base}/frame/layui/layui.all.js"></script>
    <style type="text/css">
        form {
            padding: 10px;
        }

    </style>
</head>
<body>
<div style="background-color:  #E7141A;">
    <i class="layui-icon layui-icon-shrink-right"  style="color: white">&nbsp;&nbsp;&nbsp;&nbsp;版式列表</i>
</div>
<table class="layui-hide" lay-filter="test" id="test"  lay-size="sm"></table>
<script type="text/html" id="barDemo">

    {{#  if(d.id==2 || d.id==3){ }}
    <i class="layui-icon layui-icon-edit" lay-event="edit" style="font-size: 20px;"></i>&nbsp;&nbsp;&nbsp;
    {{#  } else { }}
    <i class="layui-icon layui-icon-edit" onclick="file()" style="font-size: 20px;"></i>&nbsp;&nbsp;&nbsp;
    {{#  } }}



</script>
<script>

    layui.use(['form', 'layedit', 'laydate', 'table'], function () {
        var form = layui.form
                , $ = layui.jquery
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                , table = layui.table;

        table.render({
            elem: '#test'
            , url: '${base}/configure/select' //数据接口
            , title: '页面版式表'
            , totalRow: true
            , toolbar: '#toolbarDemo'//打印
            , cols: [[
                {
                    field: 'id', title: '序号', templet: function (val) {
                        return val.LAY_INDEX
                    }, align: 'center'
                }
                , {field: 'type', title: '配置类型', align: 'center'}
                , {field: 'configure', title: '配置值', templet: function (val) {
                    if(val.id==1){
                        return '<div><img src='+'${base}/configure/getPhoto?path='+val.configure+''+' /></div>';
                    }else{
                        return val.configure;
                    }

                    } ,align: 'center'}
                , {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 100, align: 'center'}
            ]]
            , id: 'testReload'
            , page:
                    {
                        layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                        , theme:
                                '#0092EF'
                        , limit:
                                10
                    }

        });

        //编辑
        table.on('tool(test)', function (obj) {
            var layEvent = obj.event;
            var data = obj.data;
            if (layEvent == "edit"&& data.id!=1) {

                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '编辑配置值',
                    shadeClose: false,
                    offset: 't',
                    area: ['400px', '280px'],
                    content: '${base}/configure/configure_edit.html',//数据接口
                    success: function (layero, index) {
                        var iframeWin = window[layero.find
                        ('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                        iframeWin.$("#id").val(data.id)
                        iframeWin.$("#type").val(data.type)
                        iframeWin.$("#configure").val(data.configure)
                        //渲染一下form表单
                        iframeWin.layui.form.render('select')
                    }
                });
            }

        });
    });


    function file() {
        layer.open({
            type: 2,
            title: '修改顶部图片',
            shadeClose: false,
            maxmin: true,
            area: ['470px', '470px'],
            content: '${base}/configure/configure_file.html?configure='+'${type.configure}',
            success: function (layero, index) {
                var body = layer.getChildFrame('body', index);
                //alert(body)
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();

            }
        });
    }

</script>
</body>
</html>